home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1999 #2 / Amiga Plus CD - 1999 - No. 2.iso / System-Boost / Emulatoren / anes / nesa-tech / NESA-fileformat.txt
Text File  |  1998-11-08  |  4KB  |  159 lines

  1.  
  2. =====================================================================
  3. NESA FILE FORMAT Documentation v1.01 (4/10-1998)
  4. =====================================================================
  5.  
  6. Document & fileformat by:........................... Morgan Johansson
  7.                                 (morgan.johansson@mbox301.swipnet.se)
  8.  
  9. Thanks to.................................. Leo Flavum (for the idea)
  10.  
  11.  
  12. Get the latest NESA player for Amiga at: 
  13.                                 http://home2.swipnet.se/~w-28134/ANES/
  14.  
  15.  
  16. What is this then? Well, NESA is a format for storing NES Audio data.
  17. As the NES has no standard music format (as far as I know), I invented
  18. NESA to implement in the A/NES emulator for Amiga. The theory is to
  19. rip the audio while it's played and then save it into a NESA (.nsa)
  20. file.
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. =====================================================================
  28. Header explanation
  29. =====================================================================
  30. The header consists of 16 bytes.
  31.  
  32.  
  33. NESAHeader:    dc.b    'NESA'            ;NES AUDIO
  34. NESAVersion:    dc.b    %00100010
  35. NESASndControl:    dc.b    %00000111
  36. NESAControl1:    dc.b    %10000000
  37. NESAControl2:    dc.b    %00000000
  38. NESAControl3:    dc.b    %00000000
  39. NESAControl4:    dc.b    %00000000
  40. NESAControl5:    dc.b    %00000000
  41. NESAControl6:    dc.b    %00000000
  42. NESALength:    dc.b    0,0,0,0
  43.  
  44.  
  45. NESAHeader
  46. ----------
  47. Here is four bytes of file-identification. Simple.
  48.  
  49.  
  50. NESAVersion
  51. -----------
  52. bit 0-4 = Version of file format (=2)
  53. bit 5-7 = Audio compression (=1)
  54.  
  55.  
  56. NESASndControl
  57. --------------
  58. Bits 0-4 explains which soundchannels that are saved in the file. 
  59.  
  60. Bit 0 = SquareWave 1
  61. Bit 1 = SquareWave 2
  62. Bit 2 = TriangleWave
  63. Bit 3 = Noise (Not yet supported!)
  64. Bit 4 = PCM (Not yet supported!)
  65.  
  66. Bits 5-7 are not in use (yet)
  67.  
  68.  
  69. NESAControl1
  70. ------------
  71. Bit 7 tells if the song was recorded on a PAL (1) or NTSC (0) system.
  72. Bit 6 = 1)32 byte title enabled
  73. Bit 5 = 1)32 byte comment enabled
  74. Bit 4 = Future
  75. Bit 3 = Future
  76. Bit 2 = Future
  77. Bit 1 = Future
  78. Bit 0 = Future
  79.  
  80. NOTE! Possible title/comment data is ALWAYS stored right after the
  81. 16-byte header bytes.
  82.  
  83.  
  84. NESALength:
  85. -----------
  86. Four bytes which tells the length of the NESA-song in bytes.
  87.  
  88.  
  89.  
  90. =====================================================================
  91. Compression types
  92. =====================================================================
  93.  
  94. The NESA header is quite flexible and will support more compression
  95. types in the future. Just be sure, if you're coding a player for NESA,
  96. to check the version bits and NOT to play the data if the version
  97. number of the file is higher than the ones you support.
  98.  
  99.  
  100. =====================================================================
  101. * Compression type 0/1
  102. =====================================================================
  103. Ignore this, for internal use only.
  104.  
  105.  
  106. =====================================================================
  107. * Compression type 2
  108. =====================================================================
  109. This type is very simple but it has some limitations (sound channels
  110. cannot be enabled or disabled during play for example). However,
  111. it should work very well when ripping title-songs and similar.
  112. A/NES v0.99.95b saves the audio in type 2.
  113.  
  114. All data is stored three-bytes-in-a-row.
  115.  
  116. Byte 1
  117. ------
  118. Bit 7-4 = Register to write ($0-$B, add $4000 to get NES-address).
  119. Bit 3-0 = Timer upper 4-bits
  120.  
  121. Note! Register values above $B will be ignored.
  122.  
  123. Byte 2
  124. ------
  125. Timer Lower 8-bits (total 12 bits)
  126.  
  127. Byte 3
  128. ------
  129. Data to be written to register
  130.  
  131.  
  132. The timer describes how many NES-vertical blanks to wait before
  133. writing the data to the current register. As several registers
  134. sometimes are written to at the same time, the timer sometimes 
  135. are zero.
  136. Note! The last three bytes of the data is always $FF $FF $FF (NOT 
  137. counted in the NESA-length in the header!)
  138.  
  139.  
  140.  
  141.  
  142.  
  143. ====================================================================
  144. History                 
  145. ====================================================================
  146.  
  147.  
  148.    v1.01
  149.    ~~~~~
  150.  - Fixed some minor errors...
  151.  
  152.  
  153.    v1.00     
  154.    ~~~~~
  155.  - First public release
  156.  
  157.  
  158.  
  159.